{literal} 
<script>
 function checkItem(task, action) 
 {
	 frm = document.frmAdmin;
	 total = frm.total.value;
	 check = false;
	 a = confirm('Do you want to delete?');
	 if(a) {
		 for(i = 1; i < total; i++) {
			 id = document.getElementById('cid' + i);
			 if (id.checked) {
				 check = true;
				 break;
			 }
		 }
		 
		 if (!check) {
			 alert('Please select item to delete!!!');
			 return false;
		 } 
		 frm.action = action;
		 frm.task.value = task;
		 frm.submit();
	 }
 }
 function deleteItem(id, action) 
 {
   frm = document.frmAdmin;
   total = frm.total.value;
   ob = document.getElementById(id);
   a = confirm('Do you want to delete?');
   if(a) {
	 ob.checked = true;	
     frm.action = action;
     frm.task.value = 'delete';
     frm.submit();
   }
 } 
 function checkAll(chkAll) 
 {
   frm = document.frmAdmin;
   total = frm.total.value;
	 if(chkAll.checked) {
		 for(i = 1; i <= total; i++) {
			 id = document.getElementById('cid' + i);
			 id.checked = true;
		 }
	 } else {
		 for(i = 1; i <= total; i++) {
			 id = document.getElementById('cid' + i);
			 id.checked = false;
		 }
		 
	 }
 } 
</script> 
<style>
form {
	margin: 0;
	padding: 0;
}
</style>
{/literal} 
<!-- Content Area -->
<div class="dma-thumbnail">
    <div class="content">
	<form name="frmAdmin" action="{$action}" method="post">    
        <div class="header">
            <h1 class="page-title">Newsletter</h1>
        </div>
    </div>
    <ul class="breadcrumb">
        <li><a href="#">Home</a> <span class="divider">/</span></li>
        <li class="active">Newsletter</li>
    </ul>
    <div class="container-fluid">
    	{if $msg}
        <div class="alert alert-success">
        <button class="close" data-dismiss="alert" type="button">×</button>
        {$msg}
        </div>
        {/if}    
        <div class="row-fluid">
            <div class="btn-toolbar">
                <button class="btn btn-primary" type="button" onClick="window.location.href='{$link_create}'"><i class="icon-plus"></i> New Newsletter</button>
                
              <label >Filter:</label>
              <input type="text" name="s_name" value="{$s_name|escape}" class="input-medium search-query" title="Search in module title." />
              <button type="submit" class="btn">Search</button>                
              <div class="btn-group">
              </div>
            </div> 
            <div class="well">
                <table class="table">
                  <thead>
                    <tr>
                    	<th> # </th>
                        <th> Subject </th>
                        <th> Created Date </th>
                        <th> Sender Information </th>
                        <th> Published </th>
                        <th> ID </th>
                        <th> Send </th>                    
                      <th style="width: 26px;"></th>
                    </tr>
                  </thead>
                  <tbody>
                  
                {if $categories}  
                {foreach from=$categories item=category}
                    <tr >
                      <td><input type="checkbox" id="cid{$category.idx}" name="cid[{$category.id}]" value="{$category.id}" title="Checkbox for row 1" /></td>
                      <td>{$category.subject}</td>
                      <td>{$category.createddate}</td>
                      <td>{$category.fromname}</td>
                      <td>{if $category.published}Yes{else}No{/if}</td>
                      <td>{$category.id}</td>
                      <td><a href="{$category.preview}">Preview/Send</a></td>                    
                      <td>
                          <a href="{$category.link}"><i class="icon-pencil"></i></a>
                          <a href="#" role="button" data-toggle="modal" onClick="javascript:deleteItem('cid{$category.idx}', '{$link_category}');"><i class="icon-remove"></i></a>
                      </td>                  
                    </tr>
                {/foreach}               
                {else}
                {/if}                  

                  </tbody>            
                </table>
            </div>
{$paging}           
        </div>
    </div>            
</div>

  <input type="hidden" value="{$total}" name="total"  />
  <input type="hidden" value="" name="task"  />
</form>

  
  <noscript>
  Warning! JavaScript must be enabled for proper operation of the Administrator backend.
  </noscript>
  <div class="clr"></div>
</div>
<!-- end of content --> 
